<template>
  <div>
    <el-form ref="form" :model="addnoticeForm" label-width="80px">
      <el-form-item label="通知标题">
        <el-input v-model="addnoticeForm.noticeTitle"></el-input>
      </el-form-item>
      <el-form-item label="通知内容">
        <el-input type="textarea" v-model="addnoticeForm.noticeContent"></el-input>
      </el-form-item>
      <!-- <el-form-item label="班级">
        <el-select v-model="addnoticeForm.noticeTime" placeholder="请选择班级">
          <el-option
            v-for="list in lists"
            :key="list.value"
            :label="list.className"
            :value="list.className"
          >
          </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="选择时间">
        <el-col :span="11">
          <el-date-picker
            type="date"
            placeholder="选择开始日期"
            v-model="addnoticeForm.noticeTime"
            style="width: 100%"
          ></el-date-picker>
        </el-col>

      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit()">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      noticeclass: "",
      lists: [],
      addnoticeForm: {
        noticeTitle: "",
        noticeContent: "",
        noticeTime: 0,
      },
    };
  },
  created() {},
  computed: {},
  methods: {
    onSubmit() {
      console.log(this.addnoticeForm);
      this.$axios
        .post("http://10.197.26.58:8001/addTnotice", this.addnoticeForm)
        .then((res) => {
          console.log(res);
          alert("添加成功");
        })
        .catch(function (error) {
          //请求失败处理
          console.log(error);
        });
    },
  },
  mounted() {
    this.$axios
      .get("http://10.197.26.58:8001/getclasslist")
      .then((response) => {
        this.lists = response.data;
        console.log(this.lists);
      });
  },
};
</script>
<style  scoped>
</style>
